package com.aaa.controller.fpa;

import com.aaa.controller.BaseController;
import com.aaa.entity.Result;
import com.aaa.entity.fpa.ResultDiv;
import com.aaa.service.fpa.ViewStatisticsService;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author ：chenang（731712841@qq.com）
 * @date ：Created in 2022/9/6 10:37
 * @description：
 * @modified By：
 * @version:
 */
@Log
@RestController
@RequestMapping("/viewStatistics")
public class ViewStatisticsController extends BaseController {
    @Autowired
    ViewStatisticsService viewStatisticsService;
    Result result = new Result();
    /**
     * 报表统计
     * @return
     */
    @RequestMapping(method = RequestMethod.POST,value = "ViewStatisticsqueryAll.do")
    public Result queryResultToReport(){
        Map map = viewStatisticsService.queryAll();
        return success(map);
    }
    /**
     * 根据id查询对应信息
     */
    @RequestMapping("queryResultById.do")
    public Result queryResultById(Integer id){
        Map<String, Object> stringDoubleMap = this.viewStatisticsService.queryById(id);
        result.setData(stringDoubleMap);
        return success(result);
    }
    /**
     * 查看显示
     * @param id
     * @return
     */
    @PostMapping("div.do")
    public Result resultDiv(Integer id){
        List<ResultDiv> resultDivs = viewStatisticsService.queryAllResultDiv(id);
        result.setData(resultDivs);
        log.info(result.toString());
        return success(result);
    }



}
